using DGZImp.Core.Utilities.Response;
using DGZImp.MdsProject.Devices.Entities;
using DGZImp.MdsProject.Models;
using DGZImp.WmsProject.IServices;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.RazorPages;

namespace DGZImp.MdsProject.Controllers
{

    [Route("api/[controller]/[action]")]
    public partial class MdsCommonController : ApiBaseController<IMdsCommonService>
    {

        public MdsCommonController(IMdsCommonService service)
        : base(service)
        {
        }

        [HttpGet]
        public async Task<ApiResponse<List<PropsItem>>> GetMdsDataPropsByCategory(int? category)
        {
            var r = await Service.GetMdsDataPropsByCategory(category);
            return ApiRes.Success(r);
        }

        [HttpGet]
        public async Task<ApiResponse<ResMdsDeviceData>> GetMdsDeviceData(long? RealDeviceId)
        {
            var r = await Service.GetMdsDeviceData(RealDeviceId);
            return ApiRes.Success(r);
        }

        [HttpPost]
        public async Task<ApiResponse<object>> ExecuteMdsDeviceAction([FromBody] ReqExecuteAction req)
        {
            var r = await Service.ExecuteMdsDeviceAction(req);
            return ApiRes.Success(r);
        }
    }
}

